package com.zjy.org.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.zjy.basic.domain.BaseDomain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Department extends BaseDomain implements Serializable { //实现序列化接口
    //部门编号
    @NotEmpty(message = "部门编号不可为空",groups = add.class) //使用时不能为空
    private String sn;
    //部门名称
    @NotEmpty(message = "部门名称不可为空",groups = update.class) //这个groups表面作用在哪个操作
    private String name;
    //上级分类id
    private String dirPath;
    //部门状态，0正常，1禁用
    private Integer state;
    //员工对象
    private Employee manager;
    //部门管理员id
    private Long manager_id;
    //上级部门
    private Department parent;
    //上级部门id
    private Long parent_id;
    private Long shop_id;

    //部门树/无限极树
    @JsonInclude(JsonInclude.Include.NON_EMPTY) //前端编辑框里，部门树最后一级没有数据就不显示
    private List<Department> children = new ArrayList<>();

    private interface add{};
    private interface update{};
}
